<?php
namespace app\admin\controller;
use app\common\controller\AdminController;
use chrome\ChromePhp;
use common\Common;
use uploadImg\UtilImage;
use app\common\model\blfyy\LibForm;

/**
 * 表单
 * @name Form.php
 * @package blfyy
 * @category controller
 * @link http://www.chanekeji.com
 * @author syben
 * @version 1.0
 * @copyright CHANGE INC
 * @since 2021-03-11
 */
class Form extends AdminController{
    private $lib_form;
	/**
	 * 构造函数
	 */
	function __construct() {
		parent::__construct ();
		$this->lib_form = new LibForm();
	}
	
	/**
	 * 表单列表页面
	 **/
	function formList(){
	    $this->getSetMenu($this);
	    //日志记录
        $this->log(__CLASS__, __FUNCTION__, "表单列表页面", 1, 'view');
		return $this->fetch("Form/formList/formList");
	}

	/**
	 * 删除表单
	 */
	function deleteForm(){
		$id = input('ids');
		$result = $this->lib_form->deleteForm($id);
		$this->log(__CLASS__, __FUNCTION__ ,"删除表单",0,'del');
		echo json_encode($result);
	}

	
	/**
	 * 表单分页
	 */
	function pagingForm(){
		$page = $this->getPageInfo($this);
		$sort = 'add_time desc';
		$conditionList = $this->getPagingList($this, array('name' => 'like'));
		$result = $this->lib_form->pagingForm( $page, $conditionList,$sort);
		$this->log(__CLASS__, __FUNCTION__ ,"表单分页",0,'view');
		echo json_encode($result);
	}
	
	/**************** 导出订单功能  ************************/
	
    /**
     * 导出表单
     */
    function importExcel(){ 
        $result = $this->lib_form->getAllForms();
        $this->log(__CLASS__, __FUNCTION__, "导出表单", 0, 'view');
        $this->lib_form->importExcel($result['data']['dataList']);
    }
}